//
//  UIButton+YKOCExection.h
//  YKOCExection
//
//  Created by edward on 2020/6/11.
//  Copyright © 2020 edward. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, YKButtonEdgeInsetsStyle) {
    /** image在上，label在下 */
    YKButtonEdgeInsetsStyleTop,
    /** image在左，label在右 */
    YKButtonEdgeInsetsStyleLeft,
    /** image在下，label在上 */
    YKButtonEdgeInsetsStyleBottom,
    /** image在右，label在左 */
    YKButtonEdgeInsetsStyleRight
};


typedef void (^ButtonClickedBlock)(UIButton *button);

@interface UIButton (YKOCExection)

- (UIButton *(^)(CGFloat x))yk_x;
- (UIButton *(^)(CGFloat y))yk_y;
- (UIButton * (^)(CGFloat maxX))yk_MaxX;
- (UIButton * (^)(CGFloat maxY))yk_MaxY;
- (UIButton *(^)(CGFloat width))yk_width;
- (UIButton *(^)(CGFloat height))yk_height;
- (UIButton *(^)(UIColor *backgroundColor))yk_backgroundColor;
- (UIButton *(^)(CGRect frame))yk_frame;
- (UIButton * (^)(CGFloat centerX))yk_centerX;
- (UIButton * (^)(CGFloat centerY))yk_centerY;
- (UIButton * (^)(CGFloat radius))yk_raduis;
- (UIButton * (^)(UIColor *borderColor))yk_borderColor;

- (UIButton *(^)(UIColor *titleColor))yk_titleColor;
- (UIButton *(^)(UIColor *titleColor,UIControlState state))yk_titleColorState;
- (UIButton *(^)(NSString *title,UIControlState state))yk_titleState;
- (UIButton *(^)(CGFloat titleFontSize))yk_titleFontSize;
- (UIButton *(^)(UIImage *image))yk_image;
- (UIButton *(^)(UIImage *image))yk_backgroundImage;
- (UIButton *(^)(UIImage *image,UIControlState state))yk_imageState;
- (UIButton *(^)(UIEdgeInsets titleInset))yk_titleInset;
- (UIButton *(^)(UIEdgeInsets imageInset))yk_imageInset;
- (UIButton *(^)(NSString *title))yk_title;

/**
 *  设置button的文字和图片的布局样式，及间距
 *
 *  @param style 文字和图片的布局样式
 *  @param space 文字和图片的间距
 */
- (void)yk_layoutButtonWithEdgeInsetsStyle:(YKButtonEdgeInsetsStyle)style
                        imageTitleSpace:(CGFloat)space;

/**
 UIButton 附加 Block 点击回调
 
 @param event 点击状态
 @param action 回调方法
 */
- (void)yk_handleControlEvent:(UIControlEvents)event withBlock:(ButtonClickedBlock)action;

@end
